<?php include 'frame-top.php'; ?>

<div class="segm" style="border-bottom:1px solid #ccc;">
	<h2><?php
		if ($this->private) {
			$titl='内部通知：';
			$btn='add_notice();';
		}
		else {
			$titl='新闻、最新动态：';
			$btn='add_news();';
		}
		echo $titl;
		if (auth::check(auth::EDIT_MEMBER))
			echo "<input type='button' value='add' onclick='$btn'>";
		?></h2>
</div>

<?php if (auth::check(auth::PRIV_STUDENT) || !$this->private) : ?>

<div class="segm">
	<ul><?php $n=0; while (list($key, $val)=each($this->data)) : ?>
		
		<li><a href="/info/view/NId/<?=$val['NId'];?>"><?=$val['Title'];?></a>
			 / <?=$val['PostTime'];?>
			<?php
			if (auth::check(auth::EDIT_MEMBER))
				echo " / <input type='button' value='edit' ".
						" onclick='edit_news({$val['NId']})' /> ".
					"<input type='button' value='del' ".
						" onclick='del_news({$val['NId']})' /> ";
			?>
		</li>

		<?php if (++$n>=30) break; ?>
		<?php endwhile; ?>
	</ul>

	<p style="text-align:right;">
		<a href="javascript:void(0);" 
			onclick="$('#news_all').show();$(this).hide();">&raquo; 
			显示全部新闻</a>
	</p>

	<ul id="news_all" style="display:none;">
		<?php while (list($key, $val) = each($this->data)) : ?>
		
		<li><a href="/info/view/NId/<?=$val['NId'];?>"><?=$val['Title'];?></a>
			<?=$val['PostTime'];?>
			<?php
			if (auth::check(auth::EDIT_MEMBER))
				echo "<input type='button' value='edit' ".
						" onclick='edit_news({$val['NId']})' /> ".
					"<input type='button' value='del' ".
						" onclick='del_news({$val['NId']})' /> ";
			?>
		</li>

		<?php endwhile; ?>
	</ul>

</div> <!-- end of course -->

<?php elseif ($this->private): ?>

<p>你当前的权限不够，不能浏览，请先登录。</p>

<?php endif; ?>

<?php include 'frame-bottom.php'; ?>
